package org.tarena.dang.action.user;

import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.Map;

import org.tarena.dang.action.BaseAction;
import org.tarena.dang.util.DynamicImageUtil;

public class ImageCodeAction extends BaseAction  {
	private InputStream out;
	
	
	public String execute() throws Exception {
		Map<String, BufferedImage> map = DynamicImageUtil.getDynamicImage();
		String code = map.keySet().iterator().next();
		session.put("code", code);
		out = DynamicImageUtil.getInputStream(map.get(code));
		return "success";
	}


	public InputStream getOut() {
		return out;
	}


	public void setOut(InputStream out) {
		this.out = out;
	}
	
}
